const util = require("../../utils/util");
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    islogin:'',
    logining:'',
    userInfo:{},
    menuitems: [
      { index: 'item one', text: '专注记录', url: '../focuslist/focuslist', icon: '../../icon/focuses.png', tips: '' },
      {  index: 'item two', text: '任务记录', url: '../missionlist/missionlist', icon: '../../icon/socord.png', tips: '' },
    ],
    listitems: [
      { text: '小工具', url: '../tool/tool', icon: '../../icon/set.png', tips: '' },
      { text: '反馈', url: '../feedback/feedback', icon: '../../icon/feedback.png', tips: '' },
      { text: '关于', url: '../aboutme/aboutme', icon: '../../icon/about.png', tips: '' }
    ]
  },
  onLoad: function () {
    let that = this
    if(util.isLoged()){
      that.setData({
        islogin : false
      })
    } else{
      that.setData({
        islogin : true
      })
    }
  },
  onShow: function(){
    const userinfo = wx.getStorageSync('userInfo')
    let that = this
    this.setData({
      userInfo:userinfo
    })
    if(util.isLoged()){
      that.setData({
        islogin : false
      })
    } else{
      that.setData({
        islogin : true
      })
    }
  },
  showModal(){
    this.setData({
      logining: 'show'
    })
  },
  hideModal() {
    this.setData({
      logining: ''
    })
  },
})